package hflyeer.gitee.com.global;

import java.io.IOException;

public class CharacterFilter implements javax.servlet.Filter {

    private String encoding = "UTF-8";

    public void destroy() {
        encoding=null;
    }

    public void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp, javax.servlet.FilterChain chain) throws javax.servlet.ServletException, IOException {
        req.setCharacterEncoding(encoding);
        resp.setCharacterEncoding(encoding);
        chain.doFilter(req, resp);
    }

    public void init(javax.servlet.FilterConfig config) throws javax.servlet.ServletException {
        if ( config.getInitParameter("ENCODING")!=null)
            encoding = config.getInitParameter("ENCODING");
    }

}
